<?
if($_POST['submit_code'] == 1){
	$code = $_POST['code'];
	$dr -> setCode($code);
	$dr -> getData("authorize");
	$apikey = $dr -> getApikey();
	?>
	<form method="POST" action="">
		<input type="hidden" name="apikey" value="<?=$apikey;?>"/>
		<input type="hidden" name="submit_apikey" value="1"/>
		<input type="submit" value="Pabeigt reģistrāciju">
	</form>
	<?
}elseif($_POST['submit_email'] == 1){
	$dr -> setEmail($_POST['email']);
	$dr -> getData("authorize");
	$code = $dr -> getCode();
	?><a target="_blank" href="http://www.draugiem.lv/profile/?api=1">Apstiprini mani šeit!</a><br/><br/>
		<form method="POST" action="">
		<input type="hidden" name="code" value="<?=$code;?>"/>
		<input type="hidden" name="submit_code" value="1"/>
		<input type="submit" value="apstiprināju draugos šo API">
		</form>
	<?
}else{
	if($_POST['submit_apikey'] != 1){
		?>
			<form method="POST" action="">
			dr.lv reģistrētais epasts <input type="text" name="email"/>
			<input type="hidden" name="submit_email" value="1"/>
			<input class="red" type="submit" value="piereģistrēt">
			</form>
			
			<form method="POST" action="">
				zinu API key: <input type="text" name="apikey" value="" size="5"/>
				<input type="hidden" name="submit_apikey" value="1"/>
				<input class="orange" type="submit" value="OK">
			</form>
		<?
	}
}
?>